﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using Sinacor.Infra.UI.Messaging;
using Sinacor.Infra.UI.Messaging.SmartClient;
using Sinacor.Infra.UI.Session;
using PSE.Framework.Configuration;

namespace SinacorTester
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private MessageManager mm;
        private SessionManager ss;

        public App()
        {
            ApplicationConfiguration.Initialize(Sinacor.Infra.Common.Configuration.SystemComponents.System, Sinacor.Infra.Common.Configuration.SystemComponents.UserInterface);

            this.Startup += new StartupEventHandler(App_Startup);
            this.Exit += new ExitEventHandler(App_Exit);
            
        }

        void App_Startup(object sender, StartupEventArgs e)
        {
            mm = MessageManager.GetInstance();
            SessionManager.IServerKeepAlive = new ServerKeepAliveCommunication();
            ss = SessionManager.GetInstance();
        }

        void App_Exit(object sender, ExitEventArgs e)
        {
            mm.Dispose();
            ss.Dispose();
        }
        
    }
}
